﻿Imports System.Security.Cryptography
Imports System.Text

''' <summary>
''' Clase del componente "Utilitarios" con funciones de encriptación de cadenas de texto
''' </summary>
''' <remarks></remarks>
Public Class Encriptador

    Public Shared Function Encriptar(strCadena As String) As String
        Dim Encoder As New UnicodeEncoding()
        Dim BytesTexto() As Byte = Encoder.GetBytes(strCadena)
        Dim Md5 As New MD5CryptoServiceProvider()
        Dim TablaBytes() As Byte = Md5.ComputeHash(BytesTexto)

        strCadena = System.Convert.ToBase64String(TablaBytes).ToString

        Encoder = Nothing
        BytesTexto = Nothing

        Return strCadena

    End Function

End Class
